<template>
  <div class="Student">
    <h2>学生姓名:{{name}}</h2>
    <h2>学生性别:{{sex}}</h2>
    <button @click="sendName">把学生姓名传给School组件</button>
  </div>
</template>

<script>
// 引入混合
export default {
  name:'MyStudent',
  data() {
    return {
      name:'最爱喝兽奶',
      sex:'男'
    }
  },
  methods:{
    sendName(){
      this.$bus.$emit('hello',this.name)
    }
  }
}
</script>

<style scoped>
.Student{
   background-color: hotpink;
   padding: 5px;
   margin-top: 30px;
}
</style>